package cn.doit.utils

import org.apache.commons.lang3.time.FastDateFormat

object TimeUtils {
  private val mformat: FastDateFormat = FastDateFormat.getInstance("mm")

  /**
    * 时间戳转化成分钟
    * @param time 必须是long类型的字符串  "12143243525"
    * @return
    */
  def dateFormatForMinute(time: String): String = mformat.format(time.toLong)

  private val hformat: FastDateFormat = FastDateFormat.getInstance("HH")

  /**
    *  时间戳转化成小时
    * @param time
    * @return
    */
  def dateFormatForHour(time: String): String = hformat.format(time.toLong)


  private val ymdformat: FastDateFormat = FastDateFormat.getInstance("yyyyMMdd")

  /**
    * long时间转化成年月日
    * @param time
    * @return
    */
  def dateFormatForYMD(time:String) ={ymdformat.format(time.toLong)}
}
